/*****************************************************************************/
/* File: Drawable.h                                                          */
/* Author: Ozon                                                              */
/*                                                                           */
/* Description:																 */
/*	Class that is ascendant for all drawable objects.						 */
/*****************************************************************************/
#pragma once

#include <windows.h>

#include <gl\gl.h>
#include <gl\glu.h>
#include <vector>
#include <algorithm>

#include "Common.h"
#include "Physics.h"

using namespace std;

class CDrawable
{
protected:
	dGeomID m_geom;
	dBodyID m_body;
	dMass m_mass;
	bool m_bMarked;	//set if marked to remove

	void SetTransform(double dMatrix[16], const double dPos[3], const double dRot[12]);
	virtual int SetupMatrices();
public:
	CDrawable(void);
	virtual ~CDrawable(void);

	virtual int Draw() = 0;
	virtual int Update(){return 0;}

	virtual int GetType() = 0;	//every object should define it's own type - types given in Common.h
	virtual void Remove(){m_bMarked = true;}

	const double* GetPosition() {return dBodyGetPosition(m_body);}
	bool IsMarked(){return m_bMarked;}

	//const double* GetPosition(){return dBodyGetPosition(m_body);}
	//const double* GetRotation(){return dBodyGetRotation(m_body);}
	//virtual int Spawn() = 0;
	//virtual int Remove() = 0;
};
